#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int count(int n)
{
	int i = 0;
	while (n != 0)
	{
		n /= 10;
		i++;
	}
	return i;
}

int main()
{
	int a = 0;
	int sum = 0;
	scanf("%d", &a);
	int c = count(a);
	int arr[5] = { 0 };
	for (int i = 0; i < 5; i++)
	{
		arr[i] = a;
		for (int j = 0; j < i; j++)
		{
			for (int k = 0; k < c; k++)
			{
				arr[i] = arr[i] * 10;
			}
			arr[i] += a;
		}
	}
	for (int i = 0; i < 5; i++)
	{
		sum += arr[i];
	}
	printf("%d", sum);
	return 0;
}